package cyx.example.ddd.domain.order.event;

import cyx.example.ddd.domain.order.model.aggregate.Order;
import cyx.example.ddd.domain.shared.DomainEvent;
import lombok.Getter;

/**
 * 订单取消事件
 * 
 * 注意：这是一个示例实现，在实际企业项目中，可能需要考虑：
 * 1. 取消原因分类
 * 2. 取消操作人信息
 * 3. 取消时间戳
 * 4. 退款相关信息
 */
@Getter
public class OrderCancelledEvent implements DomainEvent {
    
    private final String orderId;
    private final String userId;
    private final String cancelReason;
    
    public OrderCancelledEvent(Order order) {
        this.orderId = order.getId();
        this.userId = order.getUserId();
        this.cancelReason = order.getCancelReason();
    }
    
    public OrderCancelledEvent(Order order, String cancelReason) {
        this.orderId = order.getId();
        this.userId = order.getUserId();
        this.cancelReason = cancelReason;
    }
    
    @Override
    public String toString() {
        return String.format("OrderCancelledEvent{orderId='%s', userId='%s', cancelReason='%s'}", 
                orderId, userId, cancelReason);
    }
} 